Skip to content

Centralize dependency diagnostics in ValidateDependencies action #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 31, 2025

Conversation

neonichu
Copy link
Collaborator

Instead of emitting diagnostics directly, individual tasks emit .dependencies files which are read by a per-target action which aggregates them. This avoids duplication of diagnostics across tasks.

rdar://156174696

@neonichu
Copy link
Collaborator Author

@swift-ci please test

@neonichu neonichu requested a review from bob-wilson July 25, 2025 23:57
@@ -493,7 +494,7 @@ fileprivate struct DependencyValidationTests: CoreBasedTests {
TestStandardTarget(
"CoreFoo", type: .framework,
buildPhases: [
TestSourcesBuildPhase(["CoreFoo.m"]),
TestSourcesBuildPhase(["CoreFoo.m", "CoreBar.m"]),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it so that the test would see duplicate diagnostics in the old implementation which this PR then fixes.

@neonichu
Copy link
Collaborator Author

@swift-ci please test

@neonichu
Copy link
Collaborator Author

Linux jobs are failing with

Unable to find error: '.contains("Missing entries in MODULE_DEPENDENCIES: Foundation")' (other errors: ["Unexpected error in querying jobs from dependency graph: The operation could not be completed. The file doesn’t exist. (for task: [\"SwiftDriver\", \"TargetB\", \"normal\", \"x86_64\", \"com.apple.xcode.tools.swift.compiler\"])"])

@neonichu
Copy link
Collaborator Author

Also same issue on Windows (TIL on Windows, the testing output uses × instead of ).

@neonichu
Copy link
Collaborator Author

@swift-ci please test

@neonichu
Copy link
Collaborator Author

From the cmake job:

TaskGeneration.swift:192:35: error: cannot find type 'ValidateDependenciesSpec' in scope

I guess I need to update the configs for that.

@neonichu
Copy link
Collaborator Author

@swift-ci please test

1 similar comment
@neonichu
Copy link
Collaborator Author

@swift-ci please test

@neonichu
Copy link
Collaborator Author

The failures on focal are expected and we're dropping the jobs in #676

diagnostics.append(contentsOf: context.makeDiagnostics(imports: allImports.map { ($0.dependency, $0.importLocations) }))
}

for diagnostic in diagnostics {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still going to create duplicates if both clang and swift sources in the same target have the same module deps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's time to merge the Swift and Clang tests as part of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

I think I'll make that a separate PR since this one is already a sizable change and self-contained.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#696 is the follow-up for avoiding cross-language duplication

neonichu added 4 commits July 30, 2025 11:11
Instead of emitting diagnostics directly, individual tasks emit .dependencies files which are read by a per-target action which aggregates them. This avoids duplication of diagnostics across tasks.

rdar://156174696
The toolchains in CI are currently breaking this test.
@neonichu neonichu force-pushed the module-deps-per-target-diagnostics branch from c4f05f2 to 5f3e28f Compare July 30, 2025 18:11
@neonichu
Copy link
Collaborator Author

@swift-ci please test

@neonichu neonichu merged commit f6d3d4f into swiftlang:main Jul 31, 2025
22 checks passed
@neonichu neonichu deleted the module-deps-per-target-diagnostics branch July 31, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants